package com.huawei.pro.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class TestController {



    @Autowired
    RestTemplate restTemplate;

//    @RequestMapping("/findProductById")
//    public String findProductById(Integer pid){
//        System.out.println("pid:"+pid);
//        return "productinfo:"+pid+",very good!";
//    }

    @RequestMapping("/test")
    public String test(){    //消费者如何调用服务的提供者：  Ribbon
       // return restTemplate.getForObejct("http://localhost:9101/findProductById?pid=1",String.class);
        return restTemplate.getForObject("http://EUREKA-CLIENT9101/findProductById?pid=1",String.class);
    }
}
